<!DOCTYPE html>
<html  lang="zh-CN" >
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, maximum-scale=5, viewport-fit=cover">
    <title>ZYNQ学习笔记-Petalinux环境搭建 | LO_StacNet的火柴盒</title>
    <meta name="description" content="ZYNQ学习笔记-Petalinux环境搭建Xilinx官方为ZYNQ编译Linux相关程序提供了一个集成工具Petalinux，利用它，用户可以快速编译在ZYNQ上运行的Linux和应用。">
<meta property="og:type" content="article">
<meta property="og:title" content="ZYNQ学习笔记-Petalinux环境搭建">
<meta property="og:url" content="https://lostacnet.top/post/31220/">
<meta property="og:site_name" content="LO_StacNet的火柴盒">
<meta property="og:description" content="ZYNQ学习笔记-Petalinux环境搭建Xilinx官方为ZYNQ编译Linux相关程序提供了一个集成工具Petalinux，利用它，用户可以快速编译在ZYNQ上运行的Linux和应用。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://s21.ax1x.com/2024/08/03/pkjhiTJ.png">
<meta property="og:image" content="https://s21.ax1x.com/2024/08/03/pkjhkk9.png">
<meta property="og:image" content="https://s21.ax1x.com/2024/08/03/pkjhAYR.png">
<meta property="og:image" content="https://s21.ax1x.com/2024/08/03/pkjhEf1.png">
<meta property="og:image" content="https://s21.ax1x.com/2024/08/03/pkjhZSx.png">
<meta property="article:published_time" content="2024-03-12T13:20:03.000Z">
<meta property="article:modified_time" content="2024-08-03T14:05:13.714Z">
<meta property="article:author" content="LO_StacNet">
<meta property="article:tag" content="ZYNQ">
<meta property="article:tag" content="Linux">
<meta property="article:tag" content="WSL">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://s21.ax1x.com/2024/08/03/pkjhiTJ.png">

    
    <link rel="icon" href="/images/favicon.ico" type="image/x-icon">

    
<link rel="stylesheet" href="/css/common.min.css">



    
        <link href="//cdn.jsdelivr.net/npm/katex@0.9.0/dist/katex.min.css" rel="stylesheet">
    
    
    
    
        <link href="//cdn.jsdelivr.net/npm/lightgallery.js@1.1.3/dist/css/lightgallery.min.css" rel="stylesheet">
    
    
    
<link rel="stylesheet" href="/css/iconfont.min.css">

    
<meta name="generator" content="Hexo 6.3.0"><style>mjx-container[jax="SVG"] {
  direction: ltr;
}

mjx-container[jax="SVG"] > svg {
  overflow: visible;
}

mjx-container[jax="SVG"][display="true"] {
  display: block;
  text-align: center;
  margin: 1em 0;
}

mjx-container[jax="SVG"][justify="left"] {
  text-align: left;
}

mjx-container[jax="SVG"][justify="right"] {
  text-align: right;
}

g[data-mml-node="merror"] > g {
  fill: red;
  stroke: red;
}

g[data-mml-node="merror"] > rect[data-background] {
  fill: yellow;
  stroke: none;
}

g[data-mml-node="mtable"] > line[data-line] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > rect[data-frame] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > .mjx-dashed {
  stroke-dasharray: 140;
}

g[data-mml-node="mtable"] > .mjx-dotted {
  stroke-linecap: round;
  stroke-dasharray: 0,140;
}

g[data-mml-node="mtable"] > svg {
  overflow: visible;
}

[jax="SVG"] mjx-tool {
  display: inline-block;
  position: relative;
  width: 0;
  height: 0;
}

[jax="SVG"] mjx-tool > mjx-tip {
  position: absolute;
  top: 0;
  left: 0;
}

mjx-tool > mjx-tip {
  display: inline-block;
  padding: .2em;
  border: 1px solid #888;
  font-size: 70%;
  background-color: #F8F8F8;
  color: black;
  box-shadow: 2px 2px 5px #AAAAAA;
}

g[data-mml-node="maction"][data-toggle] {
  cursor: pointer;
}

mjx-status {
  display: block;
  position: fixed;
  left: 1em;
  bottom: 1em;
  min-width: 25%;
  padding: .2em .4em;
  border: 1px solid #888;
  font-size: 90%;
  background-color: #F8F8F8;
  color: black;
}

foreignObject[data-mjx-xml] {
  font-family: initial;
  line-height: normal;
  overflow: visible;
}

.MathJax path {
  stroke-width: 3;
}

mjx-container[display="true"] {
  overflow: auto hidden;
}

mjx-container[display="true"] + br {
  display: none;
}
</style></head>

    <body>
        <header class="header header-fixture">
    <div class="profile-search-wrap flex sm:block">
        
        
        <div class="profile sm:text-center md:px-1 lg:px-3 sm:pb-4 sm:pt-6">
            <a id="avatar" role="link" href="http://www.lostacnet.top" class="inline-block lg:w-16 lg:h-16 w-8 h-8 m-2" target="_blank" rel="noopener" rel="noreferrer" >
                <img src="/images/avatar.jpg" class="rounded-full" alt="avatar">
            </a>
            <h2 id="name" class="hidden lg:block">LO_StacNet</h2>
            <h3 id="title" class="hidden lg:block">电子玩家 &amp; 理想主义</h3>
            
            <small id="location" class="hidden lg:block">
                <i class="iconfont icon-map-icon"></i>
                Sichuan, China
            </small>
            
        </div>
        
        
<div class="search flex-1 flex lg:inline-block sm:hidden lg:px-4 lg:mt-2 lg:mb-4 lg:w-full">
    <form id="search-form" class="my-auto flex-1 lg:border lg:border-solid lg:border-gray-200">
        <div class="input-group table bg-gray-100 lg:bg-white w-full">
            <input id="search-input" type="text" placeholder="搜索" class="inline-block w-full bg-gray-100 lg:bg-white p-1">
            <span class="table-cell">
                <button name="search tigger button" disabled>
                    <i class="iconfont icon-search m-2"></i>
                </button>
            </span>
        </div>
    </form>
        
<div id="content-json" data-placeholder="搜索" class="invisible hidden">/content.json</div>
<script id="search-teamplate" type="text/html" data-path="/content.json">
    <div>
        <div class="search-header bg-gray-400">
            <input id="actual-search-input" model="keyword" ref="input" class="inline-block w-full h-10 px-2 py-1" placeholder="搜索" type="text">
        </div>
        <div class="search-result bg-gray-200">
            {{#each searchPosts}}
            <a href="/{{ path }}" class="result-item block px-2 pb-3 mb-1 pt-1 hover:bg-indigo-100">
                <i class="iconfont icon-file"></i>
                <h1 class="result-title inline font-medium text-lg">{{ title }}</h1>
                <p class="result-content text-gray-600 text-sm">{{{ text }}}</p>
            </a>
            {{/each}}
        </div>
    </div>
</script>

</div>


        <button name="menu toogle button" id="menu-toggle-btn" class="block sm:hidden p-3" role="button" aria-expanded="false">
            <i class="iconfont icon-hamburger"></i>
        </button>
    </div>
    <nav id="menu-nav" class="hidden sm:flex flex-col">
        
        
            <div class="menu-item menu-home" role="menuitem">
                <a href="/.">
                    <i class="iconfont icon-home" aria-hidden="true"></i>
                    <span class="menu-title">首页</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-archives" role="menuitem">
                <a href="/archives">
                    <i class="iconfont icon-archive" aria-hidden="true"></i>
                    <span class="menu-title">归档</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-categories" role="menuitem">
                <a href="/categories">
                    <i class="iconfont icon-folder" aria-hidden="true"></i>
                    <span class="menu-title">分类</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-tags" role="menuitem">
                <a href="/tags">
                    <i class="iconfont icon-tag" aria-hidden="true"></i>
                    <span class="menu-title">标签</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-links" role="menuitem">
                <a href="/links">
                    <i class="iconfont icon-friend" aria-hidden="true"></i>
                    <span class="menu-title">友链</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-about" role="menuitem">
                <a href="/about">
                    <i class="iconfont icon-cup" aria-hidden="true"></i>
                    <span class="menu-title">关于</span>
                </a>
            </div>
        
        
<div class="social-links flex sm:flex-col lg:hidden mt-5">
    
        <span class="social-item text-center">
            <a target="_blank" rel="noopener" href="https://github.com/LOStacNet">
                <i class="iconfont social-icon icon-github"></i>
                <span class="menu-title hidden lg:inline">menu.github</span>
            </a>
        </span>
    
        <span class="social-item text-center">
            <a target="_blank" rel="noopener" href="https://gitee.com/LOStacNet">
                <i class="iconfont social-icon icon-project"></i>
                <span class="menu-title hidden lg:inline">menu.project</span>
            </a>
        </span>
    
</div>


    </nav>
</header>

        <section class="main-section">
            
    <main class="flex-1 px-4 py-14 md:px-5 lg:px-8 lg:py-4 relative min-h-screen">
    

    <article class="content article article-archives article-type-list" itemscope="">
        <header class="article-header">
            
    
        <h1 class="article-title text-lg" itemprop="name">
            ZYNQ学习笔记-Petalinux环境搭建
        </h1>
    



            <p class="article-meta mb-3 text-xs">
                <span class="article-date">
    <i class="iconfont icon-calendar-check"></i>
	<a href="/post/31220/" class="article-date">
	  <time datetime="2024-03-12T13:20:03.000Z" itemprop="datePublished">3月 12</time>
	</a>
</span>

                
    <span class="article-category">
    <i class="iconfont icon-folder"></i>
    <a class="article-category-link" href="/categories/ZYNQ%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/">ZYNQ学习笔记</a>
  </span>


                
    <span class="article-tags">
    <i class="iconfont icon-tag"></i>
    <a class="article-tag-none-link" href="/tags/Linux/" rel="tag">Linux</a>, <a class="article-tag-none-link" href="/tags/WSL/" rel="tag">WSL</a>, <a class="article-tag-none-link" href="/tags/ZYNQ/" rel="tag">ZYNQ</a>
  </span>


                <span class="_partial/post-comment"><i class="icon icon-comment"></i>
                    <a href="/post/31220/#comments" class="article-comment-link">
                        评论
                    </a>
                </span>
                
    
        <span class="post-wordcount" itemprop="wordCount">字数统计: 1.3k(字)</span>
    
    
        <span class="post-readcount" itemprop="timeRequired">阅读时长: 5(分)</span>
    


            </p>
        </header>
        <div class="marked-body article-body">
            <h1 id="ZYNQ学习笔记-Petalinux环境搭建"><a href="#ZYNQ学习笔记-Petalinux环境搭建" class="headerlink" title="ZYNQ学习笔记-Petalinux环境搭建"></a>ZYNQ学习笔记-Petalinux环境搭建</h1><p>Xilinx官方为ZYNQ编译Linux相关程序提供了一个集成工具Petalinux，利用它，用户可以快速编译在ZYNQ上运行的Linux和应用。</p>
<span id="more"></span>

<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>开始我使用了2018.3版本的petalinux以配合我的vivado，但是发现WSL最老是18.04.6，而2018.3版本的petalinux只能到16.因此要么升级petalinux，要么降级ubuntu，这里由于wsl不能降级，最后选择了升级到2019.1，安装步骤只有版本号不同，其他一样。然而后来发现2019.1的只支持vivado2019.1到出的工程，因此最后只能无奈安装低版本的ubuntu。这里留下原教程，以供参考。</p>
<h2 id="下载安装文件"><a href="#下载安装文件" class="headerlink" title="下载安装文件"></a>下载安装文件</h2><p>这里需要准备<a target="_blank" rel="noopener" href="http://old-releases.ubuntu.com/releases/16.04.4/">ubuntu-16.04.4-desktop-amd64.iso</a>  和petalinux-v2018.3-final-installer.run。</p>
<p>之后安装ubuntu虚拟机–这里需要设置如下：</p>
<p><img src="https://s21.ax1x.com/2024/08/03/pkjhiTJ.png" alt="image-20240316145228094"></p>
<p>需要共享USB。最少需要50g的磁盘空间。</p>
<h2 id="安装VMware-Tool"><a href="#安装VMware-Tool" class="headerlink" title="安装VMware Tool"></a>安装VMware Tool</h2><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/williamcsj/article/details/121019391">参考教程</a></p>
<h2 id="安装依赖"><a href="#安装依赖" class="headerlink" title="安装依赖"></a>安装依赖</h2><p>输入以下命令安装：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install tofrodos iproute2 gawk gcc g++ git make net-tools libncurses5-dev \</span><br><span class="line">tftpd zlib1g:i386 libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat \</span><br><span class="line">xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib build-essential \</span><br><span class="line">libsdl1.2-dev libglib2.0-dev screen pax gzip automake</span><br></pre></td></tr></table></figure>

<h2 id="安装程序"><a href="#安装程序" class="headerlink" title="安装程序"></a>安装程序</h2><p>之后输入以下命令进行安装：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">mkdir</span> petalinux2018.3 <span class="comment"># 设置路径</span></span><br><span class="line">./petalinux-v2018.3-final-installer.run petalinux2018.3/ <span class="comment"># 安装</span></span><br></pre></td></tr></table></figure>

<p>由于WSL的ubuntu的shell默认使用dash，需要先将其切换为bash：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo dpkg-reconfigure dash</span><br></pre></td></tr></table></figure>

<p>在弹出的命令框中选择NO。</p>
<p>之后进入安装文件夹，输入命令添加环境变量：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> settings.sh</span><br></pre></td></tr></table></figure>

<p>之后使用<code>echo $PETALINUX</code>检查是否成功。</p>
<h2 id="安装驱动"><a href="#安装驱动" class="headerlink" title="安装驱动"></a>安装驱动</h2><p>在petalinux目录下有一个tools文件夹，其中包含了驱动，这里先把jatg断开连接。</p>
<p>进入以下目录：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tools/xsct/SDK/2018.3/data/xicom/cable_drivers/lin64/install_script/install_drivers</span><br></pre></td></tr></table></figure>

<p>运行该目录下的文件：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./install_drivers</span><br></pre></td></tr></table></figure>

<p>如果驱动遇到问题，可以使用下面的命令删除驱动：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo rm -f /etc/udev/rules.d/52-xilinx-digilent-usb.rules</span><br><span class="line">sudo rm -f /etc/udev/rules.d/52-xilinx-ftdi-usb.rules</span><br><span class="line">sudo rm -f /etc/udev/rules.d/52-xilinx-pcusb.rules</span><br></pre></td></tr></table></figure>



<h1 id="WSL安装方法——对较新版本"><a href="#WSL安装方法——对较新版本" class="headerlink" title="WSL安装方法——对较新版本"></a>WSL安装方法——对较新版本</h1><h2 id="文件下载"><a href="#文件下载" class="headerlink" title="文件下载"></a>文件下载</h2><p>这里使用2018.3版本的petalinux，在<a target="_blank" rel="noopener" href="https://china.xilinx.com/support/download/index.html/content/xilinx/zh/downloadNav/embedded-design-tools.html">官网</a>下载<code>petalinux-v2018.3-final-installer.run</code>。直接复制到linux子系统中。</p>
<p>使用<code>chmod +x xxx</code>命令设置为可执行文件。</p>
<h2 id="安装依赖-1"><a href="#安装依赖-1" class="headerlink" title="安装依赖"></a>安装依赖</h2><p>首先需要确保WSL的版本为WSL2，使用以下命令查询：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wsl -l -v</span><br></pre></td></tr></table></figure>

<p>查看version版本，如果不是2，使用以下命令修改：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wsl --set-version &lt;distribution name&gt; &lt;versionNumber&gt;</span><br></pre></td></tr></table></figure>

<p>如果失败，自行搜索windows的WSL2安装，这里不多说了。注意使用的系统为<code>Ubuntu 18.04.6 LTS</code>。<strong>新版系统不支持老版本的Petalinux</strong>。</p>
<p>之后，需要安装相关的依赖库，输入以下命令安装：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install tofrodos iproute2 gawk gcc g++ git make net-tools libncurses5-dev \</span><br><span class="line">tftpd zlib1g:i386 libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat \</span><br><span class="line">xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib build-essential \</span><br><span class="line">libsdl1.2-dev libglib2.0-dev screen pax gzip automake</span><br></pre></td></tr></table></figure>

<p>其中zlib1g:i386需要使用以下命令单独安装：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo dpkg --add-architecture i386</span><br><span class="line">sudo apt-get update</span><br><span class="line">sudo apt-get install zlib1g:i386</span><br></pre></td></tr></table></figure>

<h2 id="安装程序-1"><a href="#安装程序-1" class="headerlink" title="安装程序"></a>安装程序</h2><p>之后输入以下命令进行安装：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">mkdir</span> petalinux2018.3 <span class="comment"># 设置路径</span></span><br><span class="line">./petalinux-v2018.3-final-installer.run petalinux2018.3/ <span class="comment"># 安装</span></span><br></pre></td></tr></table></figure>

<p>由于WSL的ubuntu的shell默认使用dash，需要先将其切换为bash：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo dpkg-reconfigure dash</span><br></pre></td></tr></table></figure>

<p>在弹出的命令框中选择NO。</p>
<p>之后进入安装文件夹，输入命令添加环境变量：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> settings.sh</span><br></pre></td></tr></table></figure>

<p>之后使用<code>echo $PETALINUX</code>检查是否成功。</p>
<h2 id="共享USB"><a href="#共享USB" class="headerlink" title="共享USB"></a>共享USB</h2><p>由于WLS2与Windows基本隔离，需要使用工具将Jtag以及其他设备共享到WLS。</p>
<p>本次需要使用到开源项目<a target="_blank" rel="noopener" href="https://github.com/dorssel/usbipd-win">usbipd-win</a>，根据使用手册下载安装。</p>
<p>安装完成后，输入以下命令查看USB设备：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">usbipd list</span><br></pre></td></tr></table></figure>

<p><img src="https://s21.ax1x.com/2024/08/03/pkjhkk9.png" alt="image-20240315210447985"></p>
<p>我电脑上的设备如上，5-1是串口，5-2就是Jtag。</p>
<p>之后根据BUSID，输入命令允许共享设备——这需要管理员身份启动：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">usbipd bind --busid 5-2</span><br></pre></td></tr></table></figure>

<p><img src="https://s21.ax1x.com/2024/08/03/pkjhAYR.png" alt="image-20240315211106348"></p>
<p>注意需要将WSL升级到最新版。</p>
<p>之后在WSL中输入<code>lsusb</code>即可查看设备。</p>
<p><img src="https://s21.ax1x.com/2024/08/03/pkjhEf1.png" alt="image-20240315211251487"></p>
<p>可以看到ID是一样的。</p>
<p>如果想要取消连接，可以使用以下命令：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">usbipd detach --busid &lt;busid&gt;</span><br></pre></td></tr></table></figure>

<h2 id="安装驱动-1"><a href="#安装驱动-1" class="headerlink" title="安装驱动"></a>安装驱动</h2><p>在petalinux目录下有一个tools文件夹，其中包含了驱动，这里先把jatg断开连接。</p>
<p>进入以下目录：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tools/xsct/SDK/2018.3/data/xicom/cable_drivers/lin64/install_script/install_drivers</span><br></pre></td></tr></table></figure>

<p>运行该目录下的文件：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./install_drivers</span><br></pre></td></tr></table></figure>

<p><img src="https://s21.ax1x.com/2024/08/03/pkjhZSx.png" alt="image-20240315212110275"></p>
<p>安装完成。</p>
<p>如果驱动遇到问题，可以使用下面的命令删除驱动：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo rm -f /etc/udev/rules.d/52-xilinx-digilent-usb.rules</span><br><span class="line">sudo rm -f /etc/udev/rules.d/52-xilinx-ftdi-usb.rules</span><br><span class="line">sudo rm -f /etc/udev/rules.d/52-xilinx-pcusb.rules</span><br></pre></td></tr></table></figure>

<h2 id="其他问题"><a href="#其他问题" class="headerlink" title="其他问题"></a>其他问题</h2><h3 id="WSL-中出现-Zone-Identifier-文件的原因和解决方法"><a href="#WSL-中出现-Zone-Identifier-文件的原因和解决方法" class="headerlink" title="WSL 中出现 :Zone.Identifier 文件的原因和解决方法"></a>WSL 中出现 :Zone.Identifier 文件的原因和解决方法</h3><p>从 Windows 直接下载文件或移动文件到 WSL 目录时，会出现类似 <code>:Zone.Identifier</code> 的文件。</p>
<p>其中包含了一些跟关联文件有关的元数据。</p>
<p>该文件因为微软的 NTFS 功能而出现，虽然没有实际用途。</p>
<h4 id="解决方法"><a href="#解决方法" class="headerlink" title="解决方法"></a>解决方法</h4><ul>
<li>移动文件时，不要通过资源管理器，而是通过 VS Code，这样不会生成该文件；</li>
<li>通过这条命令删除该文件：<code>find . -name "*:Zone.Identifier" -type f -delete</code>。</li>
</ul>

        </div>
        
<blockquote class="copyright">
    <p><strong>本文链接 : </strong><a class="permalink" href="https://lostacnet.top/post/31220/">https://lostacnet.top/post/31220/</a></p>
    <p><strong>This article is available under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" rel="noopener noreferrer">Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)</a> License  转载请注明出处</strong></p>
</blockquote>


    </article>
    
    <section id="comments">
        
    </section>


    

</main>


<aside style="" id="sidebar" class="aside aside-fixture">
    <div class="toc-sidebar">
        <nav id="toc" class="article-toc">
            <h3 class="toc-title">文章目录</h3>
            <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#ZYNQ%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-Petalinux%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA"><span class="toc-number">1.</span> <span class="toc-text">ZYNQ学习笔记-Petalinux环境搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-number">1.1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85%E6%96%87%E4%BB%B6"><span class="toc-number">1.2.</span> <span class="toc-text">下载安装文件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85VMware-Tool"><span class="toc-number">1.3.</span> <span class="toc-text">安装VMware Tool</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96"><span class="toc-number">1.4.</span> <span class="toc-text">安装依赖</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E7%A8%8B%E5%BA%8F"><span class="toc-number">1.5.</span> <span class="toc-text">安装程序</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E9%A9%B1%E5%8A%A8"><span class="toc-number">1.6.</span> <span class="toc-text">安装驱动</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#WSL%E5%AE%89%E8%A3%85%E6%96%B9%E6%B3%95%E2%80%94%E2%80%94%E5%AF%B9%E8%BE%83%E6%96%B0%E7%89%88%E6%9C%AC"><span class="toc-number">2.</span> <span class="toc-text">WSL安装方法——对较新版本</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%B8%8B%E8%BD%BD"><span class="toc-number">2.1.</span> <span class="toc-text">文件下载</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96-1"><span class="toc-number">2.2.</span> <span class="toc-text">安装依赖</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E7%A8%8B%E5%BA%8F-1"><span class="toc-number">2.3.</span> <span class="toc-text">安装程序</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%B1%E4%BA%ABUSB"><span class="toc-number">2.4.</span> <span class="toc-text">共享USB</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E9%A9%B1%E5%8A%A8-1"><span class="toc-number">2.5.</span> <span class="toc-text">安装驱动</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%B6%E4%BB%96%E9%97%AE%E9%A2%98"><span class="toc-number">2.6.</span> <span class="toc-text">其他问题</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#WSL-%E4%B8%AD%E5%87%BA%E7%8E%B0-Zone-Identifier-%E6%96%87%E4%BB%B6%E7%9A%84%E5%8E%9F%E5%9B%A0%E5%92%8C%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95"><span class="toc-number">2.6.1.</span> <span class="toc-text">WSL 中出现 :Zone.Identifier 文件的原因和解决方法</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95"><span class="toc-number">2.6.1.1.</span> <span class="toc-text">解决方法</span></a></li></ol></li></ol></li></ol></li></ol>
        </nav>
    </div>
</aside>





        </section>
        <footer class="hidden lg:block fixed bottom-0 left-0 sm:w-1/12 lg:w-1/6 bg-gray-100 z-40">
    
    <div class="footer-social-links">
        
            <a target="_blank" rel="noopener" href="https://github.com/LOStacNet">
                <i class="iconfont icon-github"></i>
            </a>
        
            <a target="_blank" rel="noopener" href="https://gitee.com/LOStacNet">
                <i class="iconfont icon-project"></i>
            </a>
        
    </div>
    
    
</footer>

        <div id="mask" class="hidden mask fixed inset-0 bg-gray-900 opacity-75 z-40"></div>
        <div id="search-view-container" class="hidden shadow-xl"></div>
        
<script src="/js/dom-event.min.js"></script>



<script src="/js/local-search.min.js"></script>



    <script src="//cdn.jsdelivr.net/npm/lightgallery.js@1.1.3/dist/js/lightgallery.min.js"></script>
    
<script src="/js/light-gallery.min.js"></script>






    </body>
</html>
